<?php /*
	
*/ ?>
<?php include("system/config.inc.php");
$donotinclude = 1;
if(isset($_REQUEST['Submit']) && trim($_REQUEST['Submit']) == "Sign Up")
{ 
	if(isset($_REQUEST['terms'])) {
		if(isset($_REQUEST['radiobutton']) &&($_REQUEST['radiobutton'])==1)	{
			$sex="Male";
		} else if(isset($_REQUEST['radiobutton']) &&($_REQUEST['radiobutton'])==2) {
			$sex="Female";
		}
		$fname=mysql_real_escape_string($_REQUEST['fname']);
		$lname=mysql_real_escape_string($_REQUEST['lname']);
		$day=mysql_real_escape_string($_REQUEST['day']);
		$month=mysql_real_escape_string($_REQUEST['month']);
		$year=mysql_real_escape_string($_REQUEST['year']);
		$dob=$day."/".$month."/".$year;
		$email=mysql_real_escape_string($_REQUEST['email']);
		$houseno=mysql_real_escape_string($_REQUEST['houseno']);
		$add1=mysql_real_escape_string($_REQUEST['add1']);
		$streetaddress=$houseno.",".$add1;
		$postcode=mysql_real_escape_string($_REQUEST['postcode']);
		$city=mysql_real_escape_string($_REQUEST['city']);
		$state=mysql_real_escape_string($_REQUEST['state']);
		$country=mysql_real_escape_string($_REQUEST['country']);
		$adddef=$streetaddress.$postcode.$city.$state.$country;
		$phone=mysql_real_escape_string($_REQUEST['phone']);
		if(isset($_REQUEST['fax']) && ($_REQUEST['fax'])!="") {
			$fax=mysql_real_escape_string($_REQUEST['fax']);
		} else { 
			$fax=0;
		}
		if(isset($_REQUEST['newsletter'])) {
			$newsletter=1;
		} else {
			$newsletter=0;
		}
			$password=md5($_REQUEST['password']);
			$sql2="select `varcustemail` from tblcustomers";
			$result=$n02586916_db->select($sql2);
			if(count($result)>0)
			{
				for($i=0;$i<count($result);$i++)
				{
					if(($result[$i]['varcustemail'])==$email)
					{
						$errmsg = $mess['sameuser'];
					}
				}
			}
		if (!isset($errmsg)) {
			$sql = "INSERT INTO `tblcustomers` (`charcustsex` , `varcustfname` , `varcustlname` ,`dtdob`, `varcustemail`,`varhouseno`,`varstreetname`,`varpostalcode`,`varcity`,`varstate`,`varcountry`,`varcustphone`,`varcustfax`,`varcustpassword`,`intnewsletter`,`intstatus`,`dtregtime` ) 
						VALUES ('$sex', '$fname', '$lname','$dob', '$email','$houseno','$add1','$postcode','$city','$state','$country','$phone','$fax','$password','$newsletter','1',NOW())";
			$insert=$n02586916_db->insert($sql);
			
			$to=$email;
			$sqlemail = "select * from tblemails";
			$resemail = $n02586916_db->select($sqlemail);
			if($resemail) {
				$subject=stripslashes($resemail[0]['varsignupsub']);
				$message12=stripslashes($resemail[0]['txtsignupmess']);
			}
			$mailsubject=$subject;
			$message=$message12;
			$headers="From:".FROMEMAIL;
			mail($to, $mailsubject, $message, $headers);
			header("location:thankyoumessage.php?msg=reg");
		}
	} else {
		$errmsg = $mess['terms']; 
	}
}
?>
<?php include("inc/head.inc.php") ?>
<body>
<table width="824" border="0" cellpadding="0" cellspacing="0"  align="center">
  
  <tr>
    <td class="headerclass"><?php include(INC."top.inc.php") ?></td>
  </tr>
  <tr>
    <td valign="top" class="maincontainer"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr><td valign="top"class="leftmenuback"><?php include(INC."left.inc.php") ?></td>
        <td valign="top">
		<form action="customer.php" method="post" name="form">
		<table width="576" border="0" align="left" cellpadding="0" cellspacing="0">
        <tr>
          <td height="23" class="head">
            <div class="pageheader">Create Your Account</div></td>
        </tr>
		
        <tr>
          <td align="center"><span class="msg">
            <?php 
			  if(isset($errmsg)) {
				echo $errmsg;
			  }
			?>
          </span></td>
        </tr>
		<tr><td style="height:5px;"></td></tr>
        <tr align="left">
          <td height="23" class="search" bgcolor="#E9E9E9" style="border:1px solid #999999;">&nbsp; Your Personal Detail </td>
        </tr>
        <tr>
          <td valign="top"><table width="100%" border="0" cellspacing="2" cellpadding="0">
            <tr>
              <td width="3%">&nbsp;</td>
              <td width="37%" align="left" class="font">Gender</td>
              <td width="2%">:</td>
              <td width="56%" class="font"><input name="radiobutton" type="radio" value="1" checked="checked" >
                Male 
                <input name="radiobutton" type="radio" value="2">
                Female</td>
              <td width="2%">&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td align="left" class="font">First Name </td>
              <td>:</td>
              <td class="font">
                <input name="fname" type="text" class="font" id="fname" value="<?php echo $fname;?>" />              </td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td align="left" class="font">Last Name </td>
              <td>:</td>
              <td class="font"><input name="lname" type="text" class="font" id="lname" value="<?php echo $lname;?>" /></td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td align="left" class="font">Date Of Birth </td>
              <td>:</td>
              <td class="font"><input name="day" type="text" class="font" id="day" size="2" maxlength="2" value="<?php echo $day;?>" />
              /
                <input name="month" type="text" class="font" id="month" size="2" maxlength="2" value="<?php echo $month;?>" />
                /
                <input name="year" type="text" class="font" id="year" size="4" maxlength="4" value="<?php echo $year;?>" />
                (day/month/year)</td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td align="left" class="font">E-Mail Address </td>
              <td>:</td>
              <td class="font"><input name="email" type="text" class="font" id="email" value="<?php echo $email;?>" /></td>
              <td>&nbsp;</td>
            </tr>
          </table></td>
        </tr>
        <tr align="left">
          <td height="23" class="search" bgcolor="#E9E9E9" style="border:1px solid #999999;">&nbsp; Your Address </td>
        </tr>
        <tr>
          <td valign="top"><table width="100%" border="0" cellspacing="2" cellpadding="0">
            <tr>
              <td>&nbsp;</td>
              <td class="font">House Number </td>
              <td>:</td>
              <td><input name="houseno" type="text" class="font" id="houseno" value="<?php echo $houseno;?>" /></td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td width="3%">&nbsp;</td>
              <td width="37%" class="font">Street Name </td>
              <td width="2%">:</td>
              <td width="38%"><input name="add1" type="text" class="font" id="add1" value="<?php echo $add1;?>" /></td>
              <td width="20%">&nbsp;</td>
            </tr>

            <tr>
              <td>&nbsp;</td>
              <td class="font">Town</td>
              <td>:</td>
              <td><input name="city" type="text" class="font" id="city" value="<?php echo $city;?>" /></td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td class="font">County</td>
              <td>:</td>
              <td><input name="state" type="text" class="font" id="state" value="<?php echo $state;?>" /></td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td class="font">Country</td>
              <td>:</td>
              <td><input name="country" type="text" class="font" id="country" value="UK"/></td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td class="font">Post Code</td>
              <td>:</td>
              <td><input name="postcode" type="text" class="font" id="postcode" value="<?php echo $postcode;?>" /></td>
              <td>&nbsp;</td>
            </tr>
          </table></td>
        </tr>
        <tr align="left">
          <td height="23" class="search" bgcolor="#E9E9E9" style="border:1px solid #999999;">&nbsp; Your Contact Information </td>
        </tr>
        <tr>
          <td valign="top"><table width="100%" border="0" cellspacing="2" cellpadding="0">
            <tr>
              <td width="3%">&nbsp;</td>
              <td width="37%" class="font">Daytime Telephone No </td>
              <td width="2%">:</td>
              <td width="38%"><input name="phone" type="text" class="font" id="phone" value="<?php echo $phone;?>" /></td>
              <td width="20%">&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td class="font">Eveningtime  Telephone No </td>
              <td>:</td>
              <td><input name="fax" type="text" class="font" id="fax" value="<?php echo $fax;?>" /></td>
              <td>&nbsp;</td>
            </tr>
          </table></td>
        </tr>
        <tr align="left">
          <td height="23" class="search" bgcolor="#E9E9E9" style="border:1px solid #999999;">&nbsp; Your Password </td>
        </tr>
        <tr>
          <td valign="top">
		   <table width="100%" border="0" cellspacing="2" cellpadding="0">
            <tr>
              <td width="3%">&nbsp;</td>
              <td width="37%" class="font">Password</td>
              <td width="2%">:</td>
              <td width="38%"><input name="password" type="password" class="font" id="password" /></td>
              <td width="20%">&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td class="font">Confirm Password </td>
              <td>:</td>
              <td><input name="cpassword" type="password" class="font" id="cpassword" /></td>
              <td>&nbsp;</td>
            </tr>
          </table></td>
        </tr>
        <tr align="left">
          <td height="23" class="search" bgcolor="#E9E9E9" style="border:1px solid #999999;">&nbsp; Additional</td>
        </tr>
        <tr>
          <td valign="top"><table width="100%" border="0" cellspacing="2" cellpadding="0">
            <tr>
              <td width="3%">&nbsp;</td>
              <td width="37%" class="font">News Letter </td>
              <td width="2%">:</td>
              <td width="38%">
                <input name="newsletter" type="checkbox" id="newsletter" value="1" checked="checked" />              </td>
              <td width="20%">&nbsp;</td>
            </tr>
          </table>
		  </td>

        </tr>
		 <tr align="left">
          <td height="23" class="search" bgcolor="#E9E9E9" style="border:1px solid #999999;">&nbsp; Terms and Conditions </td>
        </tr>
		<tr>
          <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="6%">&nbsp;</td>
              
              <td width="5%">
                <input name="terms" type="checkbox" id="terms" value="1" /></td>
              <td width="89%"><a href="terms_of_use.php" class="font">Terms and conditions</a> </td>
            </tr>

          </table>
		  </td>
        </tr>
        <tr>
          <td align="center" valign="top">
            <input name="Submit" type="submit" class="feature_headingbg" value="Sign Up" onClick="return check();" /></td>
        </tr> 
    </table></form></td>
      </tr>
    </table>
    </td>
  </tr>
  <tr>
    <td><?php include "inc/bottom.inc.php"; ?></td>
  </tr>
</table>
</body>
</html>
